Repository navigation
Conversation
Without a managed config, the Codex router menu came from every cached system.ai GPT and OSS service, while Codex could only start models in its own catalog. Router picks such as gpt-6-luna then failed spawn_agent with "Unknown model". Routed launches now use one catalog file for both. A configured model_catalog_json is used as before. Otherwise ug discovers the system.ai models Codex can use from /codex/v1/models, builds the catalog with prepare_codex_catalog like a managed list, and passes it to Codex. When discovery fails, the session has no catalog and no routing. Co-authored-by: Isaac <no-reply@databricks.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
With smart routing on and no managed config, a routed subagent can fail because the router picks a model Codex does not have. For example, on eng-ml-inference-team-us-west-2 the router picked
gpt-6-luna, Codex rejected it withUnknown model, and the session showed "The default subagent model wasn't available; retrying with a supported one."This happens because ug and Codex build their model lists from different sources:
routes:select)system.aimodel whose name looks like GPT or a known OSS family, saved byug configure(codex_models+oss_models)/modelshows andspawn_agentaccepts)/codex/v1/models, which leaves out GPT unless a model location is givenOnly 10 of the 29 router options could actually be started. The other 19 (all
gpt-6-*on an older Codex, older GPT versions,gpt-oss,deepseek,kimi-k3-neo) fail whenever the router picks them.When a catalog file is configured (for example a managed model list), this does not happen: ug reads the router menu from that file and Codex loads the same file, so the two lists match.
What this PR does
Every routed Codex launch now uses one catalog file for both the router and Codex.
system.aimodels Codex can use, by calling/codex/v1/modelswith the model locationsystem.ai. With a location set, the gateway includes GPT models. ug turns the result into a catalog withprepare_codex_catalog, the same builder used for managed model lists, so GPT models keep Codex's own settings and native names. The file is passed to Codex withmodel_catalog_json, and the router menu is read from it.codex/v1/models is not enabled for this workspace): ug prints the reason and the session starts without a catalog and without routing.Because Codex does not fetch models from the gateway when a catalog file is set, both lists stay the same for the whole session.
Approaches considered
codex debug models)What changes for users
/modelshowssystem.ai.*names, the same as users with a managed model list already see./codex/v1/modelsyet, routed sessions start without automatic model switching instead of routing to models that may fail.What does not change
~/.ucodeand is not linked into Codex App settings.Code changes
agents/codex.py:_launch_smart_routinguses the configured catalog or writes one with the new_write_smart_routing_catalog. Discovered models are sorted newest GPT first, so the starting model is still the newest GPT.smart_routing/v2.py:launch_codextakescatalog_path, passes it to Codex, and builds the router menu from it. The fallback to the savedcodex_modelsandoss_modelsis removed.codex_config.py:custom_catalog_models()is replaced bylisted_catalog_models(path).agents/codex_catalog.py:prepare_codex_catalogcan skip the "missing metadata" warnings. They make sense for admin chosen models, but would print on every launch for discovered ones.Testing
uv run pytest): 4809 passed.tests/test_skills.py::test_orchestrator_injects_the_installed_agent_instructionsalso fails onmainlocally and was deselected.ruff check,ruff format --check, andty checkpass.system.aimodels (18 GPT plus glm and kimi), the starting model wasgpt-6.1-sol, the router pickedsystem.ai.gpt-6-luna, andgpt-6-lunais in the written catalog, so Codex can start it.This pull request and its description were written by Isaac.